package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import dominio.beans.*;



public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	config.addAnnotatedClass(Cliente.class)
//        		.addAnnotatedClass(PoliticasDeVentas.class)
 //       	.addAnnotatedClass(OrdenDePedido.class)
        		.addAnnotatedClass(Producto.class)
        		.addAnnotatedClass(Proveedor.class);
 //       	.addAnnotatedClass(StockRodamiento.class);
        	 
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
    
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
